//
//  CRSessionConfigurateProtocol.h
//  TestPrj
//
//  Created by 朱铅峰 on 2020/9/28.
//  Copyright © 2020 Xing. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CRMessageModel.h"

typedef NS_ENUM(NSUInteger, CRKitSessionState) {
    CRKitSessionStateNormal = 0,
    CRKitSessionStateSelect,
};

@protocol CRSessionInteractorDelegate <NSObject>

- (void)didFetchMessageData;

- (void)didRefreshMessageData;

- (void)didPullUpMessageData;


@end

@protocol CRSessionInteractor <NSObject>

//网络接口
- (void)sendMessage:(CRMessage *)message;

- (void)sendMessage:(CRMessage *)message toMessage:(CRMessage *)toMessage;

- (void)sendMessage:(CRMessage *)message completion:(void(^)(NSError * error))completion;

- (void)sendMessage:(CRMessage *)message
          toMessage:(CRMessage *)toMessage
         completion:(void(^)(NSError * error))completion;

//界面操作接口
- (void)addMessages:(NSArray *)messages;

- (void)insertMessages:(NSArray *)messages;

- (CRMessageModel *)updateMessage:(CRMessage *)message;

- (CRMessageModel *)deleteMessage:(CRMessage *)message;

- (void)addPinForMessage:(CRMessage *)message;

- (void)removePinForMessage:(CRMessage *)message;

//数据接口
- (NSArray *)items;

- (void)markRead;

- (CRMessageModel *)findMessageModel:(CRMessage *)message;

- (void)resetMessages:(void (^)(NSError *error))handler;

- (void)loadMessages:(void (^)(NSArray *messages, NSError *error))handler;

- (void)pullUpMessages:(void(^)(NSArray *messages, NSError *error))handler;

- (NSInteger)findMessageIndex:(CRMessage *)message;

- (BOOL)messageCanBeSelected:(CRMessage *)message;

- (void)loadMessagePins:(void (^)(NSError *error))handler;

- (void)willDisplayMessageModel:(CRMessageModel *)model;

//排版接口

- (void)resetLayout;

- (void)changeLayout:(CGFloat)inputHeight;

- (void)cleanCache;

- (void)pullUp;

//按钮响应接口
- (void)mediaAudioPressed:(CRMessageModel *)messageModel;

- (void)mediaPicturePressed;

- (void)mediaShootPressed;

- (void)mediaLocationPressed;

//页面状态同步接口

- (void)onViewWillAppear;

- (void)onViewDidDisappear;

//页面状态切换接口(正常/选择)
- (CRKitSessionState)sessionState;

- (void)setSessionState:(CRKitSessionState)sessionState;

- (void)setReferenceMessage:(CRMessage *)message;

@end
